import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

//导入utils/request.js   暴露出一个自定义的axios对象
import $http from './utils/request'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const app = createApp(App);
app.use(router)
// CROS跨域是否允许凭证 
$http.defaults.withCredentials = true;
//把axios为app的全局属性, app的全局属性名$axios
app.config.globalProperties.$http = $http;

//使用Elementplus
app.use(ElementPlus)

//Elementplus的icon
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
//挂载元素,放在最后
app.mount('#app')
